<?php
	require 'config.php';
	$k = $_GET['keywords'];
	
	$from_url = $_SERVER['HTTP_REFERER'];
	//print_r($from_url);exit;
	switch(true)
	{
		case preg_match ("/one.dev\/blog.html/i",$from_url):
		case preg_match ("/one.dev\/blog-\d+.html/i",$from_url):
		case preg_match ("/one.dev\/page-\d+.html/i",$from_url):
			$data = $_->articles->_select(array('id','title','description','catename','cates','addtime','author'),array('title LIKE'=>$k));
			break;
		case preg_match ("/one.dev\/temp.html/i",$from_url):
		case preg_match ("/one.dev\/portfolio.html/i",$from_url):
		case preg_match ("/one.dev\/portfolio-\d+.html/i",$from_url):
		case preg_match ("/one.dev\/single-\d+.html/i",$from_url):
			$data = $_->product->_select(array('id','title','description','catename','cates','addtime','author'),array('title LIKE'=>$k));
			break;
		default:
			//die('0');//搜索所有；
			$data = $_->articles->_select(array('id','title','description','catename','cates','addtime','author'),array('title LIKE'=>$k));
			break;
	}
	$total = count($data);
	$smarty->_assign(array('data','total'));
	$smarty->_display();
?>